<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
      <el-form-item label="日期">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
        ></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <div>
      总发放数量: {{ totalSendCount }}
    </div>
    <div>
      总发放人数: {{ totalSendPeopleCount }}
    </div>
    <div>
      总发放主号个数: {{ totalSendNumberCount }}
    </div>
    

    </el-form>
    <el-table
      v-loading="loading"
      :data="list.slice((pageNum-1)*pageSize,pageNum*pageSize)"
      style="width: 100%;"
    >
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="ID" align="center" prop="userName" :show-overflow-tooltip="true" />
      <el-table-column label="昵称" align="center" prop="nickName" :show-overflow-tooltip="true" />
      <el-table-column label="发放对象ID" align="center" prop="nickName" :show-overflow-tooltip="true" />
      <el-table-column label="发放对象昵称" align="center" prop="nickName" :show-overflow-tooltip="true" />
      <el-table-column label="发放时间" align="center" prop="loginDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.loginDate) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="发放数量" align="center" prop="nickName" :show-overflow-tooltip="true" />
    </el-table>

    <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />

  </div>
</template>

<script>
import { sendMail, userManagerList, modifyUser, changeUserStatus } from "@/api/system/user";

export default {
  name: "SellerLog",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,

      title: "",

      totalSendCount: "",   // 总发放数量
      totalSendPeopleCount: "", // 总发放人数
      totalSendNumberCount: "", // 总发放主号个数

      // 日期范围
      dateRange: [],
      // 表格数据
      list: [],

      pageNum: 1,
      pageSize: 10,
    };
  },
  created() {
    this.totalSendCount = "123456"
    this.totalSendPeopleCount = "333444"
    this.totalSendNumberCount = "654321"
    this.getList();
  },
  methods: {
    /** 查询登录日志列表 */
    getList() {
      this.loading = true;
      userManagerList(this.queryParams).then(response => {
        this.list = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.pageNum = 1;
      this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
    },
  }
};
</script>

